<template>
    <div id="tmpl">
      <div id="main">
         <h4>{{info.title}}</h4>
         <div id="content">
               {{info.content}}
         </div>
      </div>
      <comment :id="id"></comment>
    </div>
</template>

<script>
  import comment from '../subcom/comment.vue'
    export default{
        components:{
          comment  ,
        },
        data(){
            return{
              id:0,
              info:[],

            }
        },
      mounted(){
        this.id=this.$route.params.id;

        this.getData()
      },
      methods:{
        getData(){

            this.$http.get('/api/newsinfo',{
                params: {
                nId:this.id
              }
            }).then(res=>{

                this.info=res.data[0];

            })
        }
      },
    }
</script>

<style scoped>
#main{
  padding: 5px;
}
  #content{
    margin-top: 20px;
  }
</style>
